package com.iotechn.unimall.admin.api.student;

import com.iotechn.unimall.core.exception.ServiceException;
import com.iotechn.unimall.data.domain.UserDO;
import com.iotechn.unimall.data.entity.BookDo;
import com.iotechn.unimall.data.entity.StudentDo;
import com.iotechn.unimall.data.model.Page;
import com.iotechn.unimall.data.privateMapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentManageServiceImpl implements StudentManageService {

    @Autowired
    StudentMapper studentMapper;

    @Override
    public Page<StudentDo> list(Integer pageNo, Integer limit) throws ServiceException {
        return studentMapper.getStudentList(Page.div(pageNo, limit, UserDO.class));
    }

    @Override
    public List<BookDo> getBookshelfByStuId(Integer id) {
        return studentMapper.getBookshelfByStuId(id);
    }

}
